#include "ros/ros.h"
#include "festival/SetVoice.h"
#include "festival/GetVoiceSet.h"

#include "festival/config.h"

int main(int argc, char **argv) {
  ros::init(argc, argv, "set_voice");
  if (argc != 2) {
    ROS_INFO("usage: set_voice name");
    return 1;
  }
  
  ros::NodeHandle n;
  ros::ServiceClient client = n.serviceClient<festival::SetVoice>("set_voice");
  festival::SetVoice srv;
  srv.request.voice.name = argv[1];
  if (client.call(srv)) {
    if (srv.response.result)
      ROS_INFO("Festival voice was successfully changed to %s", srv.request.voice.name.c_str());
    else
      ROS_ERROR("Failed to set voice %s", srv.request.voice.name.c_str());
  } else {
    ROS_ERROR("Failed to call service set_voice");
    return 1;
  }

  return 0;
}
